Skip to content

[skip-changelog] Migrate tests from test_main.py to main_test.go #1836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 12, 2022

Conversation

MatteoPologruto
Copy link
Contributor

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)

What kind of change does this PR introduce?

This PR is a followup to PR #1806
Integration tests that were previously present in test_main.py have been rewritten in main_test.go, without changing their original purpose.
The tests are the following:

  • TestHelp
  • TestVersion
  • TestLogOptions
  • TestInventoryCreation

I had to introduce a way to skip blank lines while checking the content of the log file written with the command version --log-format json --log-file path/log.json in TestLogOptions. It seems that VSCode does not handle well a stream of JSONs and expects the end of the file to be sooner than the actual file's end, leaving a blank line in place of the last line of the file as a result, potentially compromising the whole test.

Does this PR introduce a breaking change, and is titled accordingly?

No


@MatteoPologruto MatteoPologruto added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Aug 12, 2022
@MatteoPologruto MatteoPologruto self-assigned this Aug 12, 2022
@CLAassistant
Copy link

CLAassistant commented Aug 12, 2022

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Aug 12, 2022

Codecov Report

Merging #1836 (f41c63d) into master (312cfdb) will decrease coverage by 0.06%.
The diff coverage is n/a.

❗ Current head f41c63d differs from pull request most recent head 8a86752. Consider uploading reports for the commit 8a86752 to get more accurate results

@@            Coverage Diff             @@
##           master    #1836      +/-   ##
==========================================
- Coverage   36.34%   36.28%   -0.07%     
==========================================
  Files         232      232              
  Lines       19496    19496              
==========================================
- Hits         7086     7074      -12     
- Misses      11583    11592       +9     
- Partials      827      830       +3     
Flag Coverage Δ
unit 36.28% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
arduino/monitor/monitor.go 41.05% <0.00%> (-6.32%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some small adjustments, but looks good overall 👍🏼

@MatteoPologruto MatteoPologruto marked this pull request as ready for review August 12, 2022 10:36
@MatteoPologruto
Copy link
Contributor Author

Thanks for the suggestion @cmaglie! Committed the changes and cleaned the commit history.

Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@arduino arduino deleted a comment from CLAassistant Aug 12, 2022
@umbynos umbynos changed the title Migrate tests in test_main.py to main_test.go [skip-changelog] Migrate tests from test_main.py to main_test.go Aug 12, 2022
Copy link
Contributor

@umbynos umbynos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@MatteoPologruto MatteoPologruto merged commit c756472 into master Aug 12, 2022
@MatteoPologruto MatteoPologruto deleted the test-to-go branch August 12, 2022 13:39
@per1234 per1234 added topic: infrastructure Related to project infrastructure and removed topic: code Related to content of the project itself labels Aug 12, 2022
cmaglie pushed a commit to cmaglie/arduino-cli that referenced this pull request Aug 22, 2022
…rduino#1836)

* Migrated TestHelp from test_main.py to main_test.go

* Migrated TestVersion from test_main.py to main_test.go

* Migrated TestInventoryCreation from test_main.py to main_test.go

* Migrated TestLogOptions to main_test.go and deleted test_main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants